﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace POVRay {
    [PRBlock("pigment")]
    public abstract class Pigment : Block {
        //TODO: PIGMENT_MODIFIER
        //TODO: PATTERN_MODIFIER(S) http://www.povray.org/documentation/view/3.7.0/401/

        //TODO: subclasses: ColorMapPigment, (pigment_map, texture_map, average, ...)

        [PRParam()]
        public Transformation Transformation { get; set; }
        
        protected virtual String GeneralParameters(int level) {
            StringBuilder sb = new StringBuilder();

            if (Transformation != null) {
                sb.Append(Scene.Indentation(level) + Transformation.ToString(level) + " ");
            }

            return sb.ToString();
        }

        #region ColorPigment

        public static ColorPigment Color(Color color) {
            return new ColorPigment(color);
        }

        public static ColorPigment Color(float white) {
            return new ColorPigment(white);
        }

        public static implicit operator Pigment(Color color) {
            return new ColorPigment(color);
        }

        public static implicit operator Pigment(float white) {
            return new ColorPigment(white);
        }

        #endregion

        #region ColorListPigment

        public static ColorListPigment Checker(Pigment pigment1, Pigment pigment2) {
            return ColorListPigment.CheckerColorListPigment(pigment1, pigment2);
        }

        public static ColorListPigment Hexagon(Pigment pigment1, Pigment pigment2, Pigment pigment3) {
            return ColorListPigment.HexagonColorListPigment(pigment1, pigment2, pigment3);
        }

        public static ColorListPigment Brick(Pigment pigment1, Pigment pigment2, float? brickSize, float? mortarSize) {
            return ColorListPigment.BrickColorListPigment(pigment1, pigment2, brickSize, mortarSize);
        }

        #endregion

        #region ColorMapPigment

        public static ColorMapPigment Agate(ColorMap colorMap, float? agateTurbulence) {
            return ColorMapPigment.AgateColorMapPigment(colorMap, agateTurbulence);
        }

        public static ColorMapPigment Boxed(ColorMap colorMap) {
            return ColorMapPigment.BoxedColorMapPigment(colorMap);
        }

        public static ColorMapPigment Bozo(ColorMap colorMap) {
            return ColorMapPigment.BozoColorMapPigment(colorMap);
        }

        public static ColorMapPigment Bumps(ColorMap colorMap) {
            return ColorMapPigment.BumpsColorMapPigment(colorMap);
        }

        public static ColorMapPigment Cells(ColorMap colorMap) {
            return ColorMapPigment.CellsColorMapPigment(colorMap);
        }

        public static ColorMapPigment Cylindrical(ColorMap colorMap) {
            return ColorMapPigment.CylindricalColorMapPigment(colorMap);
        }

        public static ColorMapPigment Dents(ColorMap colorMap) {
            return ColorMapPigment.DentsColorMapPigment(colorMap);
        }

        public static ColorMapPigment Gradient(ColorMap colorMap, Vector3 orientation) {
            return ColorMapPigment.GradientColorMapPigment(colorMap, orientation);
        }

        public static ColorMapPigment Granite(ColorMap colorMap) {
            return ColorMapPigment.GraniteColorMapPigment(colorMap);
        }

        public static ColorMapPigment Leopard(ColorMap colorMap) {
            return ColorMapPigment.LeopardColorMapPigment(colorMap);
        }

        public static ColorMapPigment Marble(ColorMap colorMap) {
            return ColorMapPigment.MarbleColorMapPigment(colorMap);
        }

        public static ColorMapPigment Onion(ColorMap colorMap) {
            return ColorMapPigment.OnionColorMapPigment(colorMap);
        }

        public static ColorMapPigment Planar(ColorMap colorMap) {
            return ColorMapPigment.PlanarColorMapPigment(colorMap);
        }

        public static ColorMapPigment Quilted(ColorMap colorMap, float? control0, float? control1) {
            return ColorMapPigment.QuiltedColorMapPigment(colorMap, control0, control1);
        }

        public static ColorMapPigment Radial(ColorMap colorMap) {
            return ColorMapPigment.RadialColorMapPigment(colorMap);
        }

        public static ColorMapPigment Ripples(ColorMap colorMap) {
            return ColorMapPigment.RipplesColorMapPigment(colorMap);
        }

        public static ColorMapPigment Spherical(ColorMap colorMap) {
            return ColorMapPigment.SphericalColorMapPigment(colorMap);
        }

        public static ColorMapPigment Spiral1(ColorMap colorMap, int numberOfArms) {
            return ColorMapPigment.Spiral1ColorMapPigment(colorMap, numberOfArms);
        }

        public static ColorMapPigment Spiral2(ColorMap colorMap, int numberOfArms) {
            return ColorMapPigment.Spiral2ColorMapPigment(colorMap, numberOfArms);
        }

        public static ColorMapPigment Waves(ColorMap colorMap) {
            return ColorMapPigment.WavesColorMapPigment(colorMap);
        }

        public static ColorMapPigment Wood(ColorMap colorMap) {
            return ColorMapPigment.WoodColorMapPigment(colorMap);
        }

        public static ColorMapPigment Wrinkles(ColorMap colorMap) {
            return ColorMapPigment.WrinklesColorMapPigment(colorMap);
        }

        #endregion

        #region ImageMapPigment

        public static ImageMapPigment Image(ImageMap imageMap) {
            return new ImageMapPigment(imageMap);
        }

        public static ImageMapPigment Image(String imageFileName) {
            return new ImageMapPigment(imageFileName);
        }

        #endregion

        #region ObjectPigment

        public static ObjectPigment Object(Object obj, Pigment outside, Pigment inside) {
            return new ObjectPigment(obj, outside, inside);
        }

        #endregion
    }
}
